import {createStore} from "vuex";

const store = createStore({
    state: {
        user: JSON.parse(window.localStorage.getItem("user")),
    },
    mutations: {
        setUser(state, data) {
            state.user = data;
            window.localStorage.setItem("user", JSON.stringify(data));
        },
        removeUser(state) {
            state.user = null;
            window.localStorage.removeItem("user");
        },
    },
});
export default store;